<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->

<!--[if !IE]><!-->

<html lang="en" class="no-js">

<!--<![endif]-->

<!-- BEGIN HEAD -->

<head>

    <include file="Inc/basic_css"/>

    <include file="Inc/basic_js"/>

    <import type="js" basepath="__JS__" file="admin" />

    <link rel="stylesheet" type="text/css" href="__PLUGIN__/bootstrap-datepicker/css/datepicker.css" />

    <script type="text/javascript" src="__PLUGIN__/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>

    <script type="text/javascript" src="__LAYUI__/layui.all.js"></script>
    <style>

        #ClassAdd{width:97%; margin:0 auto; display:none;}/* height:1px; overflow:hidden; */

        #class_title{ padding:10px 0;}

        .time-controler{display: inline-block;overflow: hidden;vertical-align:middle;}

        .time-controler *{float:left}

    </style>

</head>

<!-- END HEAD -->

<!-- BEGIN BODY -->

<body class="page-header-fixed">

<!-- BEGIN HEADER -->

<include file="Inc/head"/>

<!-- END HEADER -->

<div class="clearfix"></div>

<!-- BEGIN CONTAINER -->

<div class="page-container">

    <!-- BEGIN SIDEBAR -->

    <include file="Inc/left"/>

    <!-- END SIDEBAR -->

    <!-- BEGIN PAGE -->

    <div class="page-content">

        <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->

        <!-- BEGIN STYLE CUSTOMIZER -->

        <include file="Inc/theme"/>

        <!-- END BEGIN STYLE CUSTOMIZER -->

        <!-- BEGIN PAGE HEADER-->

        <div class="row">

            <div class="col-md-12">

                <!-- BEGIN PAGE TITLE & BREADCRUMB-->

                <h3 class="page-title">

                    意向订单 <small></small>

                </h3>

                <ul class="page-breadcrumb breadcrumb">

                    <li><i class="fa fa-home"></i><a href="{:U('Index/index')}">首页</a> <i class="fa fa-angle-right"></i></li>

                    <li><a href="#">意向订单</a><i class="fa fa-angle-right"></i></li>

                    <li><a href="#">{$cfg.title}</a></li>

                </ul>

            </div>

        </div>

        <!-- END PAGE HEADER-->

        <!-- BEGIN PAGE CONTENT-->

        <div class="row">

            <div class="col-md-12">

                <!-- BEGIN EXAMPLE TABLE PORTLET-->

                <div class="portlet-body">

                    <div class="table-toolbar">

                        <div class="row">

                                <div class="col-lg-10">

                                    <form class="form-inline" name="search" method="get" action="__URL__/index">

                                        <!-- <a href="{:U('Driver/driver_edit')}" class="btn blue">添加司机<i class="fa fa-plus"></i></a> -->

                                      

                                        <input class="form-control input-medium" placeholder="手机号" type="text" name="key" value="{$Think.get.key}"> 



                                        

                                       <!--  <div class="time-controler">

                                            <input class="form-control  form-control-inline input-small date-picker" type="text" data-date-format="yyyy-mm-dd" name="from_time"  value="{$shArray['from_time']?$shArray['from_time']:''}" >

                                            <a class="btn default">To</a>

                                            <input class="form-control  form-control-inline input-small date-picker" type="text" data-date-format="yyyy-mm-dd" name="to_time"  value="{$shArray['to_time']?$shArray['to_time']:''}">

                                        </div> -->



                                        <input type="submit" value="提交" class="btn blue">
                                        

                                    </form>

                                </div>

                        </div>

                    </div>



                    <div role="grid" class="dataTables_wrapper form-inline">

                        <!-- /.row -->

                        <div class="table-scrollable" id="listArea" style="border:0px;">

                            <form method="post" name="myform" id="myform">

                                <table class="table table-striped table-bordered table-advance table-hover">



                                    <thead>

                                    <tr>

                                        <!-- <th align="center"><i class="fa fa-check-square"> 选中</th> -->

                                        <th align="center" ><i class="fa fa-tag"> 订单号</th>
                                        <!-- <th align="center" >标签备注</th> -->
                                        <th align="center" >用户名(昵称)</th>
                                        <th align="center" >车型</th>
                                        <th align="center" >发货地址</th>
                                        <th align="center" >收货地址</th>
                                        <th align="center" >发货时间</th>
                                        <th align="center" >订单状态</th>
                                        <th align="center" >来源</th>
                                        <th align="center" >类型</th>
                                        <!-- <th align="center" >归属</th> -->
                                        <th align="center" >总价</th>
                                        <th align="center" >处理状态</th>
                                        <th align="center" style="width: 250px;">客服备注</th>
                                        <th align="center" >操作</th>


                                    </tr>

                                    </thead>

                                    <tbody>



                                    <foreach name="list" item="item" >

                                        <tr>

                                            <!-- <td align="center"><input type="checkbox" name="id[]" value="{$item.id}" /></td> -->
                                            <PHP>$cartypeInfo=json_decode($item['cartype_info'],true)</PHP>
                                            <PHP>$productInfo=json_decode($item['product_info'],true)</PHP>

                                            <td align="center" class="" name="title_cn" rel="{$item.id}" isfresh="0" para="input">
                                                <if condition="($item['is_title'] eq 1)and($item['is_date'] eq 1)">
                                                    <div class="addtitle" data-date="{$item.is_title}" data="{$item.id}" style="background-color:red;color:#fff; width:20px;height:20px;border:1px;border-radius:5px;">提</div>
                                                </if>{$item.id}
                                            </td>
                                            <!-- <td align="center">{$item.title_content}</td> -->
                                            <td align="center">{$item.nickname}</td>
                                            <td align="center" >{$cartypeInfo.cartype_title}</td>
                                            <td align="center" >{$item.departure}</td>
                                            <td align="center" >{$item.arrival}</td>
                                            <td align="center" >{$item.booktime}</td>
                                            <td align="center" >{$statusArr[$item['status']]['status']}</td>
                                            <td align="center" ><if condition="$item['from'] eq baidu">百度<else />微信</if></td>
                                            <td align="center" >{$productInfo.product_title}</td>
                                            <!-- <td align="center" ><if condition="$item.is_online eq 1">线上<else/>线下</if></td> -->
                                            <td align="center" >￥{$item.total_price}</td>
                                            <td align="center" >
                                                <select class="form-control input-small select_color_1" name="is_status" rel="{$item.id}" isfresh="0" para="select">
                                                    <foreach name="is_status" item="items" key="key">
                                                        <option value="{$key}" <if condition="$key eq $item.is_status && $item.is_status neq ''"> selected </if> class="select_color_{$key}">{$items.status}</option>
                                                    </foreach>
                                                </select>
                                            </td>
                                            <td align="center" style="width: 250px;" class="TextTd" name="content" rel="{$item.id}" isfresh="0" para="input">{$item.content}</td>

                                    

                                            <td align="center">
                                                <div class="zznews">
                                                    <!-- <a class="btn yellow dropdown-toggle addtitle" data-date="{$item.is_title}" data='{$item.id}' title="标签">标签</a>
                                                    <a class="btn blue  dropdown-toggle" href="{:U('Buyers/edit',['id'=>$item['id'],'product_id'=>1])}" title="修改内容">帮助下单</a>
                                                    <a class="btn red  dropdown-toggle" rel="{:U('Buyers/del','id='.$item['id'])}" title="删除" onclick="Confirm_ajax($(this).attr('rel'),'确认要删除么？');">删除</a> -->
                                                    <a class="btn dropdown-toggle" href="{:U('Buyers/edit',['id'=>$item['id'],'product_id'=>1])}" title="下单">下单</a>
                                                    <a class="btn dropdown-toggle addtitle" data-date="{$item.is_title}" data='{$item.id}' title="标签">标签</a>
                                                    <a class="btn dropdown-toggle" rel="{:U('Buyers/del','id='.$item['id'])}" title="删除" onclick="Confirm_ajax($(this).attr('rel'),'确认要删除么？');">删除</a>
                                                </div>
                                            </td>

                                        </tr>

                                    </foreach>

                                    </tbody>

                                </table>

                              

                            </form>

                        </div>

                        <div class="row" id="pageArea">

                            {$page}

                        </div>

                    </div>

                </div>

            </div>

        </div>
        <div id="datainfo" style="position:absolute;z-index: 999;width:50%;margin-left:15%;bottom:45% ;display: none;border:1px solid #333;background-color: #eee;">
            <div class="modal-body">
                <table class="table table-bordered table-advance table-hover" >
                    <tbody>
                        <tr>
                            <th>订单号</th>
                            <td><input id="order_id" value="" readonly></td>
                        </tr>
                        <tr>
                            <th>时间标签</th>
                            <td><input id="title_time" value=""></td>
                        </tr>
                        <tr>
                            <th>备注</th>
                            <td><textarea id="title_content"></textarea></td>
                        </tr>
                        <input type="hidden" id="is_title" value="">
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="info_submit">提交</button>
                <button type="button" class="btn btn-primary" id="info_reset">取消提醒</button>
                <button type="button" class="btn btn-default" id="info_close">关闭</button>
            </div>


        </div>
        <div id="contentinfo" style="position:absolute;z-index: 999;width:50%;margin-left:15%;bottom:45% ;display: none;border:1px solid #eee;background-color: #ddd;">
            <div class="modal-body">
                <table class="table table-bordered table-advance table-hover" >
                    <tbody>
                        <tr>
                            <th>备注</th>
                            <td><textarea id="content"></textarea></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="content_submit">保存</button>
                <button type="button" class="btn btn-default" id="content_close">关闭</button>
            </div>


        </div>
        <!-- END PAGE CONTENT -->

    </div>

</div>

<!-- <div id="img_preview" class="modal fade modal-scroll" tabindex="-1" data-replace="true" style="display: none;" aria-hidden="true">

    <div class="modal-dialog">

        <div class="modal-content">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

                <h4 class="modal-title">图片预览</h4>

            </div>

            <div class="modal-body">

                <img id="preview" style="width: 540px" alt="" src="">

            </div>

            <div class="modal-footer">

                <button type="button" data-dismiss="modal" class="btn green">Close</button>

            </div>

        </div>

    </div>

</div> -->

<!-- END CONTAINER -->

<!-- BEGIN FOOTER -->

<include file="Inc/foot"/>

<!-- END FOOTER -->

<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->



<!-- END CORE PLUGINS -->

<!-- BEGIN PAGE LEVEL SCRIPTS -->

<script src="__JS__/form-components.js"></script>

<script src="__JS__/app.js" type="text/javascript"></script>

<script src="__JS__/AjaxList.js.php?action=ajaxlistinput&url={:urlencode(U('Buyers/ajaxListInput'))}"></script>

<!-- END PAGE LEVEL SCRIPTS -->

<script>
     $(function(){
        //添加备注
        $('.addcontent').click(function(){
            var id = $(this).attr('data');
            $.ajax({
                type:"POST",
                url:"{:U('Order/content_edit')}",
                data: {'id':id}, 
                success:function (res){
                    console.log(res)
                    $('#order_id').val(res.id);
                    $('#title_time').val(res.title_time);
                    $('#title_content').val(res.title_content);
                    $('#datainfo').show();
                }
            });
          return false;
        })
        //添加标签
        $('.addtitle').click(function(){
            var id = $(this).attr('data');
            var is_title = $(this).data('date');
            $('#is_title').val(is_title);//是否已经提醒
            if(is_title==1){
                $('#info_reset').text('取消提醒');
            }else{
                $('#info_reset').text('恢复提醒');
            }
            $.ajax({
                type:"POST",
                url:"{:U('Order/title_edit')}",
                data: {'id':id}, 
                success:function (res){
                    console.log(res)
                    $('#order_id').val(res.id);
                    $('#title_time').val(res.title_time);
                    $('#title_content').val(res.title_content);
                    $('#datainfo').show();
                }
            });
          return false;
        })
        $('#info_submit').click(function(){
            var id = $('#order_id').val();
            var title_time = $('#title_time').val();
            var title_content = $('#title_content').val();
            var is_title = $('#is_title').val();
            $.ajax({
                type:"POST",
                url:"{:U('Order/title_save')}",
                data: {'id':id,'title_time':title_time,'title_content':title_content,'is_title':is_title}, 
                success:function (res){
                    console.log(res)
                    layer.msg(res.msg);
                    $('#datainfo').hide();
                    setTimeout(function(){
                        window.location.reload();
                    },1000)
                }
            });
        })
        //取消-恢复提醒
        $('#info_reset').click(function(){
            var id = $('#order_id').val();
            var is_title=$('#is_title').val();
            $.ajax({
                type:"POST",
                url:"{:U('Order/title_reset')}",
                data: {'id':id,'is_title':is_title}, 
                success:function (res){
                    console.log(res)
                    layer.msg(res.msg);
                    $('#datainfo').hide();
                    setTimeout(function(){
                        window.location.reload();
                    },1000)
                }
            });
        })
        $('#info_close').click(function(){
            $('#datainfo').hide();
        })
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            laydate.render({
                elem: '#title_time', //指定元素
                type:'date'
            });

        });
    })
    jQuery(document).ready(function() {

        App.init(); // initlayout and core plugins

        FormComponents.init();

    });

    // imagePreview();

</script>

<script language="javascript">



    function findNext(v , e , dom){

        var selValue = parseInt(v);

        var areaNextId = parseInt(e+1);

        $("#"+dom+"_"+areaNextId).remove();

        $("#"+dom+"_"+e+" > select > option").each(function(i){

            if($(this).attr('value') == v){

                $(this).attr('selected',true);

            }

        });







        var data = { r: Math.random(),selValue: selValue,areaNextId: areaNextId  ,domId: dom};

        $.ajax({type:"GET", url:"<php>echo U('Buyers/ajaxFindNext');</php>",data: data, dataType:"text",async:false,success:function (msg){

        r = msg;

        }});

    if (r==0) {

        return false;

    } else {

        $('#'+dom+'_'+e).append(r);

        return true;

    }





    }



    $(function(){

        {$content}

    });



</script>



<!-- END PAGE LEVEL SCRIPTS -->



</body>

<!-- END BODY -->

</html>

